package com.hnust.dao;

import com.hnust.domain.Class;
import com.hnust.domain.Student;
import com.hnust.domain.StudentGradReport;
import com.hnust.domain.TestMajorAndGrade;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: Yjx
 * @Data: 2021/12/11 19:37
 * @Version 1.0
 * @Project_Name: exam-master
 * @describe
 */
@Mapper
@Repository
public interface PaperResultDao {
    //通过考试Id获取到考试的专业
    @Select("select test_majid,test_grade from test where testid = #{examId}")
    public List<TestMajorAndGrade> getMajor(@Param("examId") String examId);

    //获取专业名称
    @Select("select name from major where maj_id = #{test_majid}")
    public String getMajorName(@Param("test_majid") String test_majid);

    //通过专业Id查找到班级数值
    @Select("select * from class where maj_id = #{test_majid} and grade = #{test_grade}")
    public List<Class> getClassId(@Param("test_majid") String test_majid,@Param("test_grade") String test_grade);

    //通过班级Id获取说所有的学生
    @Select("select * from student where cls_id = #{classId}")
    public List<Student> getStudentByClassId(@Param("classId") String classId);

    //获取学生的考试分数字符串
    @Select("select test_stu_score from result_detail where testid = #{testid} and studentId = #{studentId}")
    public String getStudentGrade(@Param("testid") String testid,@Param("studentId") String studentId);

    //获取考试名字
    @Select("select test_name from test where testid = #{testid}")
    public String getTestName(@Param("testid") String testid);

    //通过考试Id获取到试卷Id

}
